
<!--信息弹窗-->
{% macro custom_info(custom) %}
<div class="modal fade" id="CompanyModal">
  <div class="modal-dialog modal-dialog-centered">
    <div class="modal-content bg-info">
      <div class="modal-header">
        <h4 class="modal-title">{{ custom.Company }}</h4>
        <button type="button" class="close" data-dismiss="modal" aria-label="Close">
          <span aria-hidden="true">&times;</span>
        </button>
      </div>
      <div class="modal-body">
        <p class="h5">地址：{{ custom.Address }}</p>
        <p class="h5">電話：{{ custom.Phone }}</p>
        <p class="h5">網址：<a href="{{ custom.Website }}" target="_blank" class="text-warning">{{ custom.Website }}</a></p>
      </div>
    </div>
    <!-- /.modal-content -->
  </div>
  <!-- /.modal-dialog -->
</div>
<!-- /.modal -->
{% endmacro %}



<!--错误页面-->
{% macro error_page(error) %}
<div class="row justify-content-center">
    <section class="content">
      <div class="error-page">
          <h3 class="headline text-warning"> {{ error.code }}!</h3>
  
          <div class="error-content">
          {% if error.code == 404 %}
          <h3><i class="fas fa-exclamation-triangle fa-3x text-warning"></i> 哎呀！找不到页面。</h3>
          <p>
              页面不存在！
              同时，你可以返回<a href="{{ url_for('index.default_page') }}">主页</a>。
          </p>
          {% elif error.code == 500 %}
          <h3><i class="fas fa-exclamation-triangle fa-3x text-warning"></i> 哎呀！服务无法响应。</h3>
          <p>
              服务出现故障，请联系技术员。
              同时，你可以返回<a href="{{ url_for('index.default_page') }}">主页</a>。
          </p>
          {% elif error.code == 403 %}
          <h3><i class="fas fa-exclamation-triangle fa-3x text-warning"></i> 哎呀！页面不可访问。</h3>
          <p>
              服务无法响应，请确认权限。
              同时，你可以返回<a href="{{ url_for('index.default_page') }}">主页</a>。
          </p>
          {% else %}{% endif %}
          </div>
          <!-- /.error-content -->
      </div>
      <!-- /.error-page -->
    </section>
</div>
{% endmacro %}


<!--默认页面-->
{% macro default_card() %}
<div class="row">
  <div class="col-lg-12">
    <div class="card card-info">
      <div class="card-header"><h3 class="card-title">功能开发中</h3></div>
      <div class="card-body">功能开发中</div>
      <div class="card-footer">确认</div>
    </div>
  </div>
</div>
{% endmacro %}


{% macro DateRangePicker_CSS() %}
<!-- DateRangePicker -->
<link rel="stylesheet" href="{{ url_for('static', filename='plugins/daterangepicker/daterangepicker.css') }}">
<link rel="stylesheet" href="{{ url_for('static', filename='plugins/daterangepicker/bootstrap-datetimepicker.min.css') }}">
{% endmacro %}


{% macro DateRangePicker_JS() %}
<!-- DateRangePicker v3.14.1 -->
<script src="{{ url_for('static', filename='plugins/daterangepicker/daterangepicker.min.js') }}"></script>
<script src="{{ url_for('static', filename='plugins/daterangepicker/bootstrap-datetimepicker.min.js') }}"></script>
{% endmacro %}


{% macro Select2_CSS() %}
<!-- Select2 -->
<link rel="stylesheet" href="{{ url_for('static', filename='plugins/select2/css/select2.min.css') }}">
<link rel="stylesheet" href="{{ url_for('static', filename='plugins/select2-bootstrap4-theme/select2-bootstrap4.min.css') }}">
{% endmacro %}


{% macro BootstrapSelect_CSS() %}
<!-- bootstrap-select -->
<link rel="stylesheet" href="{{ url_for('static', filename='plugins/bootstrap-select/bootstrap-select.min.css') }}">
{% endmacro %}


{% macro Timepicker_CSS() %}
<!-- Timepicker -->
<link rel="stylesheet" href="{{ url_for('static', filename='plugins/timepicker/bootstrap-timepicker.min.css') }}">
{% endmacro %}


{% macro Select2_JS() %}
<!-- Select2 -->
<script src="{{ url_for('static', filename='plugins/select2/js/select2.full.min.js') }}"></script>
{% endmacro %}


{% macro BootstrapSelect_JS() %}
<!-- bootstrap-select -->
<script src="{{ url_for('static', filename='plugins/bootstrap-select/bootstrap-select.min.js') }}"></script>
{% endmacro %}


{% macro LayDate_JS() %}
<!-- LayDate -->
<script src="{{ url_for('static', filename='plugins/laydate/laydate.js') }}"></script>
{% endmacro %}


{% macro Timepicker_JS() %}
<!-- Timepicker -->
<link rel="stylesheet" href="{{ url_for('static', filename='plugins/timepicker/bootstrap-timepicker.min.js') }}">
{% endmacro %}


{% macro ECharts_JS() %}
<!-- ECharts -->
<script src="{{ url_for('static', filename='plugins/echarts/echarts.min.js') }}"></script>
{% endmacro %}


{% macro DataTables_CSS() %}
<!-- DataTables -->
<link rel="stylesheet" href="{{ url_for('static', filename='plugins/DataTables/DataTables-1.10.25/css/dataTables.bootstrap4.min.css') }}">
<link rel="stylesheet" href="{{ url_for('static', filename='plugins/DataTables/Responsive-2.2.9/css/responsive.bootstrap4.min.css') }}">
<link rel="stylesheet" href="{{ url_for('static', filename='plugins/DataTables/Buttons-1.7.1/css/buttons.bootstrap4.min.css') }}">
{% endmacro %}


<!--数据表-->
{% macro DataTables_JS() %}
<!-- DataTables  & Responsive -->
<script src="{{ url_for('static', filename='plugins/DataTables/DataTables-1.10.25/js/jquery.dataTables.min.js') }}"></script>
<script src="{{ url_for('static', filename='plugins/DataTables/DataTables-1.10.25/js/dataTables.bootstrap4.min.js') }}"></script>
<script src="{{ url_for('static', filename='plugins/DataTables/Responsive-2.2.9/js/dataTables.responsive.min.js') }}"></script>
<script src="{{ url_for('static', filename='plugins/DataTables/Responsive-2.2.9/js/responsive.bootstrap4.min.js') }}"></script>
{% endmacro %}



{% macro DataTables_Export_JS() %}
<!-- DataTables  & Plugins -->
<script src="{{ url_for('static', filename='plugins/DataTables/Buttons-1.7.1/js/dataTables.buttons.min.js') }}"></script>
<script src="{{ url_for('static', filename='plugins/DataTables/Buttons-1.7.1/js/buttons.bootstrap4.min.js') }}"></script>
<script src="{{ url_for('static', filename='plugins/DataTables/JSZip-2.5.0/jszip.min.js') }}"></script>
<!-- <script src="{{ url_for('static', filename='plugins/DataTables/pdfmake-0.2.2/pdfmake.min.js') }}"></script>
<script src="{{ url_for('static', filename='plugins/DataTables/pdfmake-0.2.2/vfs_fonts.js') }}"></script> -->
<script src="{{ url_for('static', filename='plugins/DataTables/Buttons-1.7.1/js/buttons.html5.min.js') }}"></script>
<script src="{{ url_for('static', filename='plugins/DataTables/Buttons-1.7.1/js/buttons.print.min.js') }}"></script>
<script src="{{ url_for('static', filename='plugins/DataTables/Buttons-1.7.1/js/buttons.colVis.min.js') }}"></script>
{% endmacro %}


<!--页脚-->
{% macro public_footer(app_info, service_version) %}
<!-- To the right -->
<div class="float-right d-none d-sm-inline">系统版本：{{ service_version }}</div>
<!-- Default to the left -->
<strong>Copyright &copy; 2020-2021 <a href="#">{{ app_info.SupportCompany }}</a></strong>
{% endmacro %}





<!--公共脚本-->
{% macro public_scripts(carpark_datetime) %}
<script>
  // 消息弹窗
  var AppMessage = Swal.mixin({toast: false, position: 'top',showConfirmButton: false,timer: 2000, allowOutsideClick: false, allowEscapeKey: false});
  // 系统时间
  var Clock = new Vue({
      el: '#Clock',
      delimiters: ['{[', ']}'],
      data: {
          AppDateTime: '{{carpark_datetime}}',
          AppWeekDay: '',
          CarParkDateTime:new Date(Date.parse('{{carpark_datetime}}')),
      },
      methods: {
          // 获取星期
          get_weekday(key){
              switch(key){
                  case 0:return '星期天'
                  case 1:return '星期一'
                  case 2:return '星期二'
                  case 3:return '星期三'
                  case 4:return '星期四'
                  case 5:return '星期五'
                  case 6:return '星期六'
              }
          },
          // 格式化时分秒
          format_carpark_time(val){if(val.length==1){return '0'+val}else{return val}},
          // 格式化时间
          carpark_datetime_format(carpark_t){
              let year_str = String(carpark_t.getFullYear()) + '年'
              let month_str = String(carpark_t.getMonth() + 1) + '月'
              let day_str = String(carpark_t.getDate()) + '日'
              let hour_str = this.format_carpark_time(String(carpark_t.getHours())) + ':'
              let minute_str = this.format_carpark_time(String(carpark_t.getMinutes())) + ':'
              let second_str = this.format_carpark_time(String(carpark_t.getSeconds()))
              this.AppWeekDay = this.get_weekday(carpark_t.getDay())
              return year_str + month_str + day_str + ' ' + hour_str + minute_str + second_str
          },
          // 更新时间
          updateTime(){
              this.CarParkDateTime.setTime(this.CarParkDateTime.setSeconds(this.CarParkDateTime.getSeconds()+1))
              this.AppDateTime = this.carpark_datetime_format(this.CarParkDateTime)}
      },
      mounted: function(){setInterval(function(){Clock.updateTime()}, 1000)}
  });
  // 加载当前时间
  Clock.updateTime()
</script>
{% endmacro %}


{% macro carpark_style() %}
<script>
  // 当网页向下滑动 20px 出现"返回顶部" 按钮
  window.onscroll = function() {
    if (document.body.scrollTop > 20 || document.documentElement.scrollTop > 20) {$("#scrobutton").css("display", "block")}
    else {$("#scrobutton").css("display", "none")}
  };
  // 样式控制
  $(".nav-link").css("font-size", "larger")
  $(".modal").css("margin-top", "2%")
  $(".form-control").css("font-size", "larger")
  $("form").css("font-size", "large")
  $("input.form-control").css("font-size", "larger")
  $("input.form-control").attr("autocomplete","off")
</script>
{% endmacro %}

